-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore ability for programs to upgrade themselves #20265
Restore ability for programs to upgrade themselves #20265
Conversation
720da24
to
6ba19bd
Compare
6ba19bd
to
7448cee
Compare
/// Inspect all message keys for the bpf upgradeable loader | ||
pub fn is_upgradeable_loader_present(&self) -> bool { | ||
match self { | ||
Self::Legacy(message) => message.is_upgradeable_loader_present(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note, but @jstarry this might be clearer if the messages implemented a trait containing is_upgradeable_loader_present
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, sounds good to me
…r is present; restore bpf upgrade-self test
7448cee
to
935f3f5
Compare
Pull request has been modified.
935f3f5
to
46957bc
Compare
Codecov Report
@@ Coverage Diff @@
## master #20265 +/- ##
=========================================
+ Coverage 82.6% 82.8% +0.1%
=========================================
Files 522 487 -35
Lines 137655 135606 -2049
Branches 293 0 -293
=========================================
- Hits 113755 112304 -1451
+ Misses 23800 23302 -498
+ Partials 100 0 -100 |
* Make helper associated fn * Add feature definition * Add handling to preserve program-id write lock when upgradeable loader is present; restore bpf upgrade-self test * Use single feature (cherry picked from commit 2cd9dc9) # Conflicts: # runtime/src/accounts.rs # sdk/program/src/message.rs # sdk/program/src/message/mapped.rs # sdk/program/src/message/sanitized.rs # sdk/src/feature_set.rs
…20295) * Restore ability for programs to upgrade themselves (#20265) * Make helper associated fn * Add feature definition * Add handling to preserve program-id write lock when upgradeable loader is present; restore bpf upgrade-self test * Use single feature (cherry picked from commit 2cd9dc9) # Conflicts: # runtime/src/accounts.rs # sdk/program/src/message.rs # sdk/program/src/message/mapped.rs # sdk/program/src/message/sanitized.rs # sdk/src/feature_set.rs * Fix conflicts Co-authored-by: Tyera Eulberg <[email protected]> Co-authored-by: Tyera Eulberg <[email protected]>
* Make helper associated fn * Add feature definition * Add handling to preserve program-id write lock when upgradeable loader is present; restore bpf upgrade-self test * Use single feature
Problem
#20263 for master
In preventing inappropriate program write locks (#19637 + #19877 ), we assumed that programs would not need to upgrade themselves (ie. the program-id of a transaction is never writable). However, various governance programs depend on this ability, using their own governance mechanism for program upgrades.
Summary of Changes
Restore program-id write lock when the upgradeable loader id is present in the transaction; feature gate and require both
restore_write_lock_when_upgradeable
anddemote_program_write_locks
features for new functionality.v1.6 vs v1.7/master compatibility will be restored when #20263 is released and these two features are activated on MNB